const _import = require('./import-' + process.env.NODE_ENV);

function getProps (route) {
  return route.query;
}

const routers = [
  {
    path: '/login',
    name: 'login',
    component: _import('login/index'),
    props: getProps,
    desc: '登录'
  },
  {
    path: '/password',
    name: 'password',
    component: _import('login/password'),
    props: getProps,
    desc: '修改密码'
  },
  {
    path: '/',
    name: 'root',
    component: _import('login/index')
  },
  {
    path: '/message',
    name: 'message',
    component: _import('message/index')
  },
  {
    path: '/my',
    name: 'my',
    component: _import('my/index')
  },
  {
    path: '/online-form',
    name: 'onlineForm',
    props: getProps,
    component: _import('online/index')
  },
  {
    path: '/online-report-form',
    name: 'onlineReportForm',
    props: getProps,
    component: _import('report/index')
  },
  {
    path: '/formMyTask',
    name: 'formMyTask',
    props: getProps,
    component: _import('workflow/formRuntimeTask/formMyTask')
  },
  {
    path: '/formMyHistoryTask',
    name: 'formMyHistoryTask',
    props: getProps,
    component: _import('workflow/formRuntimeTask/formMyHistoryTask')
  },
  {
    path: '/formMyApprovedTask',
    name: 'formMyApprovedTask',
    props: getProps,
    component: _import('workflow/formRuntimeTask/formMyApprovedTask')
  },
  {
    path: '/handlerFlowTask',
    component: _import('workflow/handlerFlowTask/index'),
    name: 'handlerFlowTask',
    props: getProps,
    meta: {title: '流程处理'},
    children: [
      // 静态表单路由设置
    ]
  },
  {
    path: '/home',
    name: 'home',
    component: _import('home/index')
  }
];

export default routers;
